package main
{
	import com.darwin.darwinDll.Dll;
	
	import flash.utils.getTimer;

	/**
	 * 游戏基本配置管理。这里包括后台请求地址的配置等
	 * @author lipi
	 */
	public class AppConfig
	{
		public function AppConfig()
		{
			if(_instance == null)
			{
				_instance = this;
			}
			else{throw new Error("实例化单例类出错-AppConfig");}
		}
		
		
		private static var _instance:AppConfig;
		
		public static function getInstance():AppConfig
		{
			if(_instance == null)
				_instance = new AppConfig();
			
			return _instance;
		}
		

		/**
		 * 平台对象
		 * @param v
		 * 			friendlistVer=0
		//			sessionCreateTime=1320715796
		//			validateKey=805640cac5b3dc3f89363a78b21e211e
		//			platformId=1
		//			userId=1152921504890333820
		 * 
		//			folder=http%3A%2F%2F192.168.1.210%2Fflash%2F
		//			languageId=1
		//			gameId=34
		//			postUrl=http%3A%2F%2F192.168.1.210%2Fflash%2FuId%3D1152921504890333820%26createTime%3D1320715796%26validateKey%3D805640cac5b3dc3f89363a78b21e211e%26gameId%3D34%26platformId%3D1%26method%3D
		//			isFan=0
		 * 
		 */
		public function set platFormObj(v:Object):void
		{
			if(v.hasOwnProperty("friendlistVer"))friendlistVer = v.friendlistVer; 
			if(v.hasOwnProperty("folder")) folder = v.folder;
			if(v.hasOwnProperty("sessionCreateTime")) sessionCreateTime = v.sessionCreateTime; 
			if(v.hasOwnProperty("validateKey")) validateKey = v.validateKey; 
			if(v.hasOwnProperty("platformId")) platformId = v.platformId; 
			if(v.hasOwnProperty("userId")) userId = v.userId; 
			if(v.hasOwnProperty("languageId")) languageId = v.languageId; 
			if(v.hasOwnProperty("gameId")) gameId = v.gameId; 
			if(v.hasOwnProperty("postUrl")) postUrl = v.postUrl; 
			if(v.hasOwnProperty("isFan")) isFan = v.isFan; 
		}
		
//		public var socketPort:String = "61241"//"62114";//端口
		public var socketPort:String = "65522"//"61241";
		public var socketHost:String = "192.168.7.207";//socket// "114.80.117.64";//
		public var folder:String = "http://192.168.1.210/flash/";
		//"C:\\Users\\Administrator\\Desktop\\";
		public var friendlistVer:String;
		public var sessionCreateTime:String;
		/**
		 * 就是c++要的sessionKey 
		 */
		public var validateKey:String="123";
		public var platformId:String;
		public var userId:String;// = "123456";//"1152921504837251773";
//		public var userId:String="10000"+int(Math.random() * 4).toString();//"1152921504890333820"; 
//		public var userId:String = "123456789"; //= "1152921504837251773";
//		public var userId:String = "1152921504948102374";
//		public var userId:String = "1152921504890333820";
//		public var userId:String = "1152921504837251773";
//		public var userId:String="100003";//+int(Math.random() * 4).toString();//"1152921504890333820"; 
		public var languageId:String;
		public var gameId:String;
		public var postUrl:String;
		public var isFan:String;
		
		public function get lang():String
		{
			switch(languageId)
			{
				case "1":
				{
					return "cn";
					break;
				}
				default:
				{
					return "cn";
					break;
				}
			}
		}
		public function start():void
		{
		}		
	}
}